package com.ruoyi.project.manhua.member.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.manhua.member.mapper.TbMemberMapper;
import com.ruoyi.project.manhua.member.domain.TbMember;
import com.ruoyi.project.manhua.member.service.ITbMemberService;
import com.ruoyi.common.utils.text.Convert;

/**
 * 会员Service业务层处理
 * 
 * @author yuan
 * @date 2021-03-03
 */
@Service
public class TbMemberServiceImpl implements ITbMemberService 
{
    @Autowired
    private TbMemberMapper tbMemberMapper;

    /**
     * 查询会员
     * 
     * @param userId 会员ID
     * @return 会员
     */
    @Override
    public TbMember selectTbMemberById(Long userId)
    {
        return tbMemberMapper.selectTbMemberById(userId);
    }

    /**
     * 查询会员列表
     * 
     * @param tbMember 会员
     * @return 会员
     */
    @Override
    public List<TbMember> selectTbMemberList(TbMember tbMember)
    {
        return tbMemberMapper.selectTbMemberList(tbMember);
    }

    /**
     * 新增会员
     * 
     * @param tbMember 会员
     * @return 结果
     */
    @Override
    public int insertTbMember(TbMember tbMember)
    {
        tbMember.setCreateTime(DateUtils.getNowDate());
        return tbMemberMapper.insertTbMember(tbMember);
    }

    /**
     * 修改会员
     * 
     * @param tbMember 会员
     * @return 结果
     */
    @Override
    public int updateTbMember(TbMember tbMember)
    {
        return tbMemberMapper.updateTbMember(tbMember);
    }

    /**
     * 删除会员对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteTbMemberByIds(String ids)
    {
        return tbMemberMapper.deleteTbMemberByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除会员信息
     * 
     * @param userId 会员ID
     * @return 结果
     */
    @Override
    public int deleteTbMemberById(Long userId)
    {
        return tbMemberMapper.deleteTbMemberById(userId);
    }
}
